// Copyright (c) 2009 http://grommet.codeplex.com
// This source is subject to the Microsoft Public License.
// See http://www.opensource.org/licenses/ms-pl.html
// All other rights reserved.

using System;

#if MicroFramework
using Microsoft.SPOT;
#endif 

namespace Grommet.Net.XBee
{
    #region Delagates

    public delegate void XBeeCallback(ApiFrame frame);

    #endregion

    #region ModemStatusChanged
    
    public class ModemStatusChangedEventArgs : EventArgs
    {
        public ModemStatus Status { get; set; }

        public ModemStatusChangedEventArgs(ModemStatus status)
        {
            this.Status = status;
        }
    }

    public delegate void ModemStatusChangedEventHandler(object sender, EventArgs e);

    #endregion

    #region PacketReceived

    public class FrameReceivedEventArgs : EventArgs
    {
        public ulong SourceSerialNumber { get; set; }
        public ushort SourceAddress { get; set; }
        public PacketOptions Options { get; set; }
        public byte[] Data { get; set; }

        public FrameReceivedEventArgs(ulong sourceSerialNumber, ushort sourceAddress, PacketOptions options, byte[] data)
        {
            this.SourceSerialNumber = sourceSerialNumber;
            this.SourceAddress = sourceAddress;
            this.Options = options;
            this.Data = data;
        }
    }

    public delegate void FrameReceivedEventHandler(object sender, FrameReceivedEventArgs e);

    #endregion

    #region IODataSampleReceived

    public class IODataSampleReceivedArgs : EventArgs
    {
        public ulong SourceSerialNumber { get; set; }
        public ushort SourceAddress { get; set; }
        public ushort DigitalChannelMask { get; set; }
        public ushort DigitalSample { get; set; }
        public byte AnalogChannelMask { get; set; }
        public ushort[] AnalogSamples { get; set; }

        public IODataSampleReceivedArgs(
            ulong sourceSerialNumber,
            ushort sourceAddress,
            ushort digitalChannelMask,
            ushort digitalSample,
            byte analogChannelMask,
            ushort[] analogSamples )
        {
            this.SourceSerialNumber = sourceSerialNumber;
            this.SourceAddress = sourceAddress;
            this.DigitalChannelMask = digitalChannelMask;
            this.DigitalSample = digitalSample;
            this.AnalogChannelMask = analogChannelMask;
            this.AnalogSamples = analogSamples;
        }
    }

    public delegate void IODataSampleReceivedHandler( object sender, IODataSampleReceivedArgs e );

    #endregion
}
